package com.aaa.multithreading.demo03;

/**
 * @author C-Q
 * @version 1.1.0
 * @Description: 以下的测试结果显示票数是无序的，是因为线程没有及时打印而时间片到了
 * @date 2022/10/31
 */
public class Test01 {
//    private static Object lock=new Object();
    public static void main(String[] args) {
//        SellTickets sell = new SellTickets();
//        Thread one = new Thread(sell,"A窗口");
//        Thread two = new Thread(sell,"B窗口");
//        Thread three = new Thread(sell,"C窗口");
//        Thread four = new Thread(sell,"D窗口");
        SellTickets01 sell = new SellTickets01();
        Thread one = new Thread(sell,"A窗口");
        Thread two = new Thread(sell,"B窗口");
        Thread three = new Thread(sell,"C窗口");
        Thread four = new Thread(sell,"D窗口");

        one.start();
        two.start();
        three.start();
        four.start();
        try {
            one.join();
            two.join();
            three.join();
            four.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
